package web.validator;

import org.springframework.stereotype.Service;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

import web.form.LoginForm;

@Service
public class LoginValidator implements Validator {
	
	public void validate(Object obj, Errors errors) {
		//LoginForm login = (LoginForm) obj;

		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "idLDAP", "error.login.required");
		//ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", "error.password.required");
	}
	
	@Override
	public boolean supports(Class<?> clazz) {
		return LoginForm.class.equals(clazz);
	}
}
